/*
 * @Description: 
 * @Author: fhw
 * @Date: 2022-11-18 11:13:34
 */
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { IsEnum, IsNotEmpty, Length, Max, Min } from 'class-validator'
import { IdDto, PageDto } from '../../common/dto/dto'
export class GetUserPageDto extends PageDto {
  @ApiPropertyOptional({
    type: String,
    name: 'id',
    description: '用户id',
  })
  public readonly id?: string
  
  @ApiPropertyOptional({
    type: String,
    name: 'username',
    description: '用户名',
  })
  public readonly username: string

}

export class GetUserInfoDto {
  @ApiPropertyOptional({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id?: number

  @ApiPropertyOptional({
    type: String,
    name: 'account',
    description: '用户名称',
  })
  public readonly account?: string
}

export class RegisterChatUserDto {
  @IsNotEmpty({ message: '用户名不能为空' })
  @ApiProperty({
    type: String,
    name: 'username',
    description: '用户名',
  })
  public readonly username: string

  @IsNotEmpty({ message: '密码不能为空' })
  @ApiProperty({
    type: String,
    name: 'password',
    description: '密码',
  })
  public readonly password: string
}
export class UpdateChatUserDto implements IdDto {
  @ApiProperty({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id: number

  @IsNotEmpty({ message: '用户名不能为空' })
  @ApiProperty({
    type: String,
    name: 'username',
    description: '用户名',
  })
  public readonly username: string

  @IsEnum(['男', '女'], {message: '只能传入男, 女'}) //枚举
  @IsNotEmpty({ message: '性别不能为空' })
  @ApiProperty({
      type: String,
      name: 'sex',
      example: '未知',
      description: '性别',
      enum: ['男', '女'],
  })
  public readonly sex: string
  
  // @Max(200, { message: '参数年龄最大值是200' })
  // @Min(0, { message: '参数年龄的值从0开始' })
  // @ApiPropertyOptional({
  //   type: String,
  //   name: 'age',
  //   description: '年龄',
  // })
  // public readonly age: string

  @ApiPropertyOptional({
    type: String,
    name: 'headimgurl',
    description: '头像',
  })
  public readonly headimgurl: string

  @ApiPropertyOptional({
    type: String,
    name: 'signature',
    description: '签名',
    nullable: true,
  })
  public readonly signature: string
}
export class  UserFindByIdsDto {
  @IsNotEmpty({ message: 'ID集合不能为空' })
  @ApiProperty({
    type: String,
    name: 'ids',
    description: 'ids',
  })
  public readonly ids: Array<number>
}
export class ValidateUserDto {
  @IsNotEmpty({ message: '用户名不能为空' })
  @ApiProperty({
    type: String,
    name: 'username',
    description: '用户名',
  })
  public readonly username: string

  @IsNotEmpty({ message: '密码不能为空' })
  @ApiProperty({
    type: String,
    name: 'password',
    description: '密码',
  })
  public readonly password: string
}
export class UpdatePassWordDto {
  @IsNotEmpty({ message: '用户ID不能为空' })
  @ApiProperty({
    type: String,
    name: 'userId',
    description: 'userId',
  })
  public readonly userId: string
  
  @IsNotEmpty({ message: '登录密码不能为空' })
  @ApiProperty({
    type: String,
    name: 'old_password',
    description: '登录密码',
  })
  public readonly old_password: string

  @IsNotEmpty({ message: '新密码不能为空' })
  @ApiProperty({
    type: String,
    name: 'new_password',
    description: '新密码',
  })
  public readonly new_password: string
}